Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #28065 - package dynflow sidekiq service files #4194

Merged
merged 2 commits into from
Oct 28, 2019

Conversation

ezr-ondrej
Copy link
Member

@ezr-ondrej ezr-ondrej commented Oct 15, 2019

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also missing the macros to install the service. I now see we do this under %preun and %postun but that's actually incorrect for subpackages. We should fix this for the -service subpackage as well. d7b23d1 (with 7f9c972) is a good example of how a subpackage can introduce a service.

packages/foreman/foreman/dynflow@.service Outdated Show resolved Hide resolved
packages/foreman/foreman/dynflow@.service Outdated Show resolved Hide resolved
packages/foreman/foreman/dynflow@.service Outdated Show resolved Hide resolved
packages/foreman/foreman/foreman.spec Show resolved Hide resolved
packages/foreman/foreman/foreman.spec Show resolved Hide resolved
packages/foreman/foreman/foreman.spec Outdated Show resolved Hide resolved
packages/foreman/foreman/foreman.spec Outdated Show resolved Hide resolved
packages/foreman/foreman/foreman.spec Outdated Show resolved Hide resolved
@@ -711,6 +713,34 @@ Meta Package to install requirements for Redis caching support
%files redis
%{_datadir}/%{name}/bundler.d/redis.rb

%package dynflow-sidekiq
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this package conflict with the regular dynflow service? Can both run at the same time? What happens if they do? Is the new dynflow-sidekiq optional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it doesn't conflict, and it is not trying to remove it, if someone runs both, they will share the load and loadbalance.
dynflow-sidekiq is installed in installer only if the option is turned on (theforeman/puppet-foreman#761) so yes, it's optional.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the singleton nature of the dynflow sidekiq orchestrator play well with the current dynflow executor if both are deployed simultaneously?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that doesn't really matter, the separation is not really affecting the old deployment.

@ezr-ondrej ezr-ondrej force-pushed the dynflow-sidekiq branch 3 times, most recently from d4a5d4f to e996cf7 Compare October 18, 2019 09:45
packages/foreman/foreman/foreman.spec Outdated Show resolved Hide resolved
sed -i '/^ExecStart/ s|/usr/bin/sidekiq \(.\+\)$|/usr/bin/scl enable tfm "sidekiq \1"|' %{buildroot}%{_unitdir}/%{dynflow_sidekiq_service_name}.service

for i in orchestrator.yml worker.yml; do
mv %{buildroot}%{_datadir}/%{name}/config/dynflow/$i %{buildroot}%{_sysconfdir}/%{name}/dynflow/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you indent these lines?

%{_unitdir}/%{dynflow_sidekiq_service_name}.service
%{_datadir}/%{name}/script/dynflow-sidekiq.rb

%install dynflow-sidekiq
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you can have separate %install sections. At least, we don't use it anywhere else.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I should install it in the main package directly? or to use build section?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main %install is fine. Then within %files you split it up again.

@ezr-ondrej ezr-ondrej force-pushed the dynflow-sidekiq branch 2 times, most recently from 7a6eef5 to 72fb13d Compare October 22, 2019 14:38
@ekohl
Copy link
Member

ekohl commented Oct 22, 2019

Also needs an entry in comps.

@ezr-ondrej
Copy link
Member Author

Added comps section, moved install to main install.

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build is failing because you need to increase the release and add a changelog.

@ezr-ondrej
Copy link
Member Author

Add changelog line

@ezr-ondrej ezr-ondrej force-pushed the dynflow-sidekiq branch 3 times, most recently from 535d6c1 to 8989c1f Compare October 22, 2019 15:52
@ekohl
Copy link
Member

ekohl commented Oct 22, 2019

The build failure is due to the nodejs changes that are going on.

@ehelms
Copy link
Member

ehelms commented Oct 22, 2019

This current design installs and starts "classic" dynflow by default. As I understood things, the target was for the new dynflow-sidekiq to be the default?

If we are keeping "classic" dynflow as the default, installing this new subpackage will configure and start dynflow-sidekiq while leaving classic dynflow running as is. Is this what a user should expect? That feels like it will lead to inconsistencies.

@ezr-ondrej
Copy link
Member Author

@ehelms this is now addressed in the installer PR theforeman/puppet-foreman#761 it will disable the old service for you once you select the sidekiq to be installed. If you are not using installer you're on your own to figure it out though.

@tbrisker
Copy link
Member

this is now blocked on the core PR: BUILDSTDERR: install: cannot stat 'extras/systemd/dynflow-sidekiq@.service': No such file or directory

@tbrisker
Copy link
Member

[test rpm]

@ezr-ondrej
Copy link
Member Author

Any idea why the tests are failing now? 😞

@ekohl
Copy link
Member

ekohl commented Oct 24, 2019

Because there wasn't a new source tarball with the new file. There is now.
[test rpm]

@ezr-ondrej
Copy link
Member Author

🍾 Thanks @ekohl.

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like @ehelms to ack as well before merging.

@@ -2,6 +2,7 @@
%global confdir extras/packaging/rpm/sources
%global foreman_rake %{_sbindir}/%{name}-rake
%global executor_service_name dynflowd
%global dynflow_sidekiq_service_name dynflow-sidekiq@
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the repetition I'm inclined to add .service here but I'm fine either way. I'd probably do a cleanup of all service handling later anyway.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to stay consistent with the dynflowd service, otherwise I would agree 🤔

@ehelms
Copy link
Member

ehelms commented Oct 24, 2019

Figured I would give this a basic runtime test, I am seeing the following (note the service timed out starting):

Oct 24 14:05:58 centos7-katello-nightly.war.example.com scl[14647]: 2019-10-24T14:05:58.249Z 14667 TID-6hbxf INFO: GitLab reliable fetch activated!
Oct 24 14:05:58 centos7-katello-nightly.war.example.com scl[14647]: 2019-10-24T14:05:58.251Z 14667 TID-fnj6v INFO: Booting Sidekiq 5.2.7 with redis options {:id=>"Sidekiq-server-PID-14667", :url=>nil}
Oct 24 14:06:00 centos7-katello-nightly.war.example.com scl[14647]: /usr/share/foreman/lib/foreman.rb:8: warning: already initialized constant Foreman::UUID_REGEXP
Oct 24 14:06:00 centos7-katello-nightly.war.example.com scl[14647]: /usr/share/foreman/lib/foreman.rb:8: warning: previous definition of UUID_REGEXP was here
Oct 24 14:06:26 centos7-katello-nightly.war.example.com scl[14647]: 2019-10-24T14:06:26.120Z 14667 TID-6hbxf INFO: Booting Sidekiq 5.2.7 with redis options {:url=>"redis://localhost:6379/0", :id=>"Sidekiq-server
Oct 24 14:06:26 centos7-katello-nightly.war.example.com scl[14647]: 2019-10-24T14:06:26.123Z 14667 TID-6hbxf INFO: Running in ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux]
Oct 24 14:06:26 centos7-katello-nightly.war.example.com scl[14647]: 2019-10-24T14:06:26.124Z 14667 TID-6hbxf INFO: See LICENSE and the LGPL-3.0 for licensing details.
Oct 24 14:06:26 centos7-katello-nightly.war.example.com scl[14647]: 2019-10-24T14:06:26.124Z 14667 TID-6hbxf INFO: Upgrade to Sidekiq Pro for more features and support: http://sidekiq.org
Oct 24 14:06:26 centos7-katello-nightly.war.example.com scl[14647]: 2019-10-24T14:06:26.126Z 14667 TID-6hbxf INFO: Starting processing, hit Ctrl-C to stop
Oct 24 14:06:26 centos7-katello-nightly.war.example.com scl[14647]: 2019-10-24T14:06:26.127Z 14667 TID-27o9cf INFO: Cleaning working queues
Oct 24 14:07:27 centos7-katello-nightly.war.example.com systemd[1]: dynflow-sidekiq@orchestrator.service start operation timed out. Terminating.
Oct 24 14:07:27 centos7-katello-nightly.war.example.com scl[14647]: 2019-10-24T14:07:27.067Z 14667 TID-6hbxf INFO: Shutting down
Oct 24 14:07:27 centos7-katello-nightly.war.example.com scl[14647]: 2019-10-24T14:07:27.067Z 14667 TID-6hbxf INFO: Terminating quiet workers
Oct 24 14:07:27 centos7-katello-nightly.war.example.com scl[14647]: 2019-10-24T14:07:27.068Z 14667 TID-27o7kj INFO: Scheduler exiting...

Further, the current design leads to unclear logging from a system perspective in my opinion:

Oct 24 14:07:27 centos7-katello-nightly.war.example.com scl[14647]: 2019-10-24T14:07:27.068Z 14667 TID-27o7kj INFO: Scheduler exiting...

Note that the service listed is scl which is entirely unclear (especially if sending logs to a service) what this is logging changes for. This scl part is derived from the fact it is running scl enable. I am also noticing the foreman service we built suffers from this same issue.

@ekohl
Copy link
Member

ekohl commented Oct 24, 2019

I'm looking at https://github.com/mperham/sidekiq/blob/master/examples/systemd/sidekiq.service and it has some neat tricks:
Reloading:

# use `systemctl reload sidekiq` to send the quiet signal to Sidekiq
# at the start of your deploy process.
ExecReload=/usr/bin/kill -TSTP $MAINPID

Memory fragmentation fix:

# Greatly reduce Ruby memory fragmentation and heap usage
# https://www.mikeperham.com/2018/04/25/taming-rails-memory-bloat/
Environment=MALLOC_ARENA_MAX=2

I'm wondering if the type=forking that's currently used is incorrect and should be type=simple. Does sidekiq fork itself?

@tbrisker
Copy link
Member

considering that this is experimental in 1.24, perhaps we can merge if it works and improve afterwards if needed?

@ehelms
Copy link
Member

ehelms commented Oct 24, 2019

@tbrisker That was my plan. My comment was to indicate I did not get it to work, and to identify some issues that if we don't fix now, are captured in issues that block it going from "beta" to "GA".

@ezr-ondrej
Copy link
Member Author

I am trying to address the comments in theforeman/foreman#7127 - not to forget them.

@adamruzicka
Copy link

adamruzicka commented Oct 24, 2019

Addressing the start timeout (it indeed was simple vs forking) and syslog identifier issues in theforeman/foreman#7128

@ezr-ondrej beat me to it :)

@tbrisker
Copy link
Member

what's the status here @ehelms @ekohl ?

@ehelms
Copy link
Member

ehelms commented Oct 25, 2019

@tbrisker I wanted to see this in action to know this packaging change plus the code works if someone installs it and then manually configures Redis. I have not reached that point yet, working through it.

@ekohl
Copy link
Member

ekohl commented Oct 25, 2019

Should we add a %exclude commit to rpm/develop in the mean time to get nightly to build again?

@ehelms
Copy link
Member

ehelms commented Oct 28, 2019

[test rpm]

@ehelms ehelms merged commit e2a302f into theforeman:rpm/develop Oct 28, 2019
@ezr-ondrej ezr-ondrej deleted the dynflow-sidekiq branch July 22, 2020 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants